<template>
  <div id="wrap">
    <h1>页面头部</h1>
    <p>{{ $route.params.id }}</p>
  </div>
</template>

<script lang="ts">
export default {
  name: 'StuDemo57Son01',
};
</script>

<script lang="ts" setup>
import { useRoute, useRouter } from 'vue-router';
//useRoute:路由上下文，能够获取路由参数；useRouter路由对象：调用对象的方法
const route = useRoute(); //路由上下文，能够获取路由参数
const router = useRouter(); //调用对象的方法

console.log(router);
console.log(route.query); //query 查询字符串  查询地址栏字符串
console.log(route.params); //路由传参
</script>

<style lang="scss"></style>
